package com.ygo.feihua;

import android.content.*;
import android.view.*;
import android.widget.*;
import java.util.*;
import cn.bmob.v3.datatype.*;
import com.bumptech.glide.*;
import java.net.*;
import android.net.*;

public class shitem extends BaseAdapter
{
	List<Map<String,Object>> data;
	Context context;
	private TextView sh_name,sh_jianjie,sh_sh;
	private ImageView sh_tb;
	int s;
	Gongju gj;
	
	public shitem(Context context, List<Map<String,Object>> data)
	{
		this.context = context;
		this.data=data;
		gj=Gongju.getdx(context);
		
	}
    public void sx(List<Map<String,Object>> data){
        this.data=data;
        notifyDataSetChanged();
    }


	public void addItem(Map<String,Object> map)
	{
		data.add(map);
		notifyDataSetChanged();
	}

	@Override
	public int getCount()
	{
		return data.size();
	}

	@Override
	public Object getItem(int position)
	{
		return data.get(position);
	}

	@Override
	public long getItemId(int position)
	{
		return position;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent)
	{
		View view = LayoutInflater.from(context).inflate(
			R.layout.shitem, null);
		sh_tb=(ImageView) view.findViewById(R.id.sh_tb);
		sh_name=(TextView) view.findViewById(R.id.sh_name);
		sh_jianjie=(TextView) view.findViewById(R.id.sh_jianjie);
		sh_sh=(TextView) view.findViewById(R.id.sh_sh);
		
		String tb=(String) data.get(position).get("tb");

		gj.tuxian(tb,sh_tb);
		
		sh_name.setText((String)data.get(position).get("name"));
		sh_jianjie.setText((String)data.get(position).get("jie"));
		sh_sh.setText((String)data.get(position).get("sh"));
		
		

		return view;
	}
	public void show(String s){
		Toast.makeText(context,s,Toast.LENGTH_SHORT).show();
	}

}
